﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using YFIN.Models;

namespace YFIN.Service.Crawlers
{
    public class News : ModelNews
    {
        public News FatherUrl { get; set; }
        public int CurrentDepth { get; set; }
        public Uri UrlLink { get; set; }


        public News(Uri url_link)
            : this(null, 0, url_link)
        {

        }

        public News(News father_url, int current_depth, Uri url_link)
        {
            this.FatherUrl = father_url;
            this.CurrentDepth = current_depth;
            this.UrlLink = url_link;
        }

        public void SetUrlDepth(int depth)
        {
            if (FatherUrl != null)
            {
                this.CurrentDepth = FatherUrl.CurrentDepth + 1;
            }
            else
            {
                this.CurrentDepth = 0;
            }
        }
    }
}